package xml.validator;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author marya
 */
public  abstract class AbstractValidator implements Validator<String>{

        protected  AbstractValidator(){
            this.messages = new ArrayList<String>();
        }

        protected List<String> messages;

        public List<String> getMessages(){
            return this.messages;
        }

        /*
         * Rajoute un message d'erreur
         */
        protected void addMessage(String message){
            this.messages.add(message);
        }

        /**
         * Remet à vide la liste des messages d'erreur
         */
        public void clearMessages(){
            this.messages=new ArrayList<String>();
        }

        public abstract boolean isValid(String data);
}
